package com.example.pharmacy.mapper;

import com.example.pharmacy.model.Cart;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: asus
 * Date: 2024-12-25
 * Time: 17:21
 */
@Mapper
public interface CartMapper {
    @Insert("insert into cart (user_id, drug_id) values (#{userId}, #{drugId})")
    Integer addDrug(Cart cart);
    @Select("select * from cart where user_id=#{userId} and is_deleted = 0")
    List<Cart> selectCartByUserId(Integer userId);
    Integer updateCart(Cart cart);
    @Select("select * from cart where cart_id = #{id} and is_deleted = 0")
    Cart selectCartByCartId(Integer id);
}
